package rsponse; /**
 * @author tongchen
 * @create 2022-11-29 12:56
 */

import org.apache.commons.io.IOUtils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.FileInputStream;
import java.io.IOException;

@WebServlet("/resp3")
public class resp3 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1.设置字节输入流
        FileInputStream inputStream = new FileInputStream("C://Drcom//DrUpdateClient//anti_viru_check.jpg");
        //2.设置字节输出流
        ServletOutputStream outputStream = response.getOutputStream();
        //进行copy
        IOUtils.copy(inputStream,outputStream);
        //将输入流关闭
        inputStream.close();

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
